﻿namespace MsForgeReboot.Framework.Entities {
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.ComponentModel.DataAnnotations.Schema;
    using System.Web.Mvc;

    using MsForgeReboot.Framework.Extensions;

    public class Speaker {
        
        public int Id { get; set; }

        [MaxLength(50)]
        [Required(AllowEmptyStrings = false)]
        [Display(Name = "Ime")]
        public string FirstName { get; set; }

        [MaxLength(50)]
        [Required(AllowEmptyStrings = false)]
        [Display(Name = "Prezime")]
        public string LastName { get; set; }

        [MaxLength(50)]
        [Display(Name = "Tviter")]
        public string Twitter { get; set; }

        [MaxLength(255)]
        [RegularExpression(ValidationExpressions.Url)]
        [Display(Name = "Linked In")]
        public string LinkedIn { get; set; }

        [MaxLength(128)]
        [RegularExpression(ValidationExpressions.Email)]
        [Display(Name = "Javni E-mail")]
        public string Email { get; set; }

        [MaxLength(255)]
        [RegularExpression(ValidationExpressions.Url)]
        [Display(Name = "Adresa bloga")]
        public string Blog { get; set; }

        [MaxLength(255)]
        [Display(Name = "Fotografija")]
        public string PicturePath { get; set; }

        [MaxLength(50)]
        [Required(AllowEmptyStrings = false)]
        [Display(Name = "Grad / Mesto")]
        public string City { get; set; }

        [DataType(DataType.Html)]
        [Required(AllowEmptyStrings = false)]
        [AllowHtml]
        [Display(Name = "Biografija")]
        public virtual string Biography { get; set; }

        [NotMapped]
        public string UrlPointer {
            get {
                return string.Format("{0}-{1}-{2}", Id, FirstName.GetUrlFriendlyText(), LastName.GetUrlFriendlyText());
            }
        }

        [NotMapped]
        [Display(Name = "Ime i prezime")]
        public string FullName
        {
            get
            {
                return string.Format("{0} {1}", FirstName, LastName);
            }
        }

        /// <summary>
        /// Gets or sets the events for speaker.
        /// </summary>
        /// <value>
        /// The events.
        /// </value>
        public virtual IList<Event> Events { get; set; }

        [UIHint("UserProfile")]
        [Display(Name = "Korisnički nalog na sajtu")]
        public virtual User UserProfile { get; set; }

    }
}